
package com.avetti.commerce.webservices;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;

import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;

import com.avetti.commerce.domainmodel.Itemattrib;
import com.avetti.simplemerce.adminpages.datatransfer.AttributemainDTO.IAttributes;

/** @author Hibernate CodeGenerator */
public class Attributes implements Serializable {

    
	private static final long serialVersionUID = 1L;
	
	/**detail attributes type (this attributes take a part on price formation)*/
	public static final String DETAIL_ATTRIBUTE_TYPE = "2";

	/** identifier field */
    private Long attributeid;

    /** persistent field */
    private long itemid=0;

    /** persistent field */
    private String attype="";

    /** nullable persistent field */
    private String cols;

    /** nullable persistent field */
    private String defvalue;

    /** nullable persistent field */
    private String prompt;

    /** nullable persistent field */
    private String dataname;

    /** nullable persistent field */
    private String dropname;

    /** nullable persistent field */
    private String rows;

    /** nullable persistent field */
    private String screenname;

    /** persistent field */
    private int chprice=0;

    /** persistent field */
    private String vendorid="";

    /** persistent field */
    private long oldattributeid=0;

    /** nullable persistent field */
    private String screenname1;

    /** nullable persistent field */
    private String screenname3;
    
    private long pagetileid=0;
    
    private Set<Itemattrib> itemlinks;
    
    private List<Options> options = new ArrayList<Options>();
    

    /** default constructor */
    public Attributes() {
    }

    /** minimal constructor */
    public Attributes(Long attributeid, long itemid, String attype, int chprice, 
            String vendorid, long oldattributeid) {
        this.attributeid = attributeid;
        this.itemid = itemid;
        this.attype = attype;
        this.chprice = chprice;
        this.vendorid = vendorid;
        this.oldattributeid = oldattributeid;
    }

    public Attributes(Attributes attribute) {
        this.attributeid = new Long(attribute.attributeid);
        this.itemid = attribute.itemid;
        this.vendorid = new String(attribute.vendorid);
        this.attype = attribute.attype == null ? null : new String(attribute.attype);
        this.cols = attribute.cols == null ? null : new String(attribute.cols);
        this.defvalue = attribute.defvalue == null ? null : new String(attribute.defvalue);
        this.prompt = attribute.prompt == null ? null : new String(attribute.prompt);
        this.dataname = attribute.dataname == null ? null : new String(attribute.dataname);
        this.dropname = attribute.dropname == null ? null : new String(attribute.dropname);
        this.rows = attribute.rows == null ? null : new String(attribute.rows);
        this.chprice = attribute.chprice;
        this.oldattributeid = attribute.oldattributeid;
        this.screenname1 = attribute.screenname1 == null ? null : new String(attribute.screenname1);
        this.screenname = attribute.screenname == null ? null : new String(attribute.screenname);
        this.screenname3 = attribute.screenname3 == null ? null : new String(attribute.screenname3);
        this.pagetileid = attribute.pagetileid;
        
        if(attribute.options !=null) {
            for(Options option : attribute.options) {
                if(option!=null) {
                    this.options.add(new Options(option));
                } else {
                    this.options.add(null);
                }
                    
            }
        }
    }
    
    /* (non-Javadoc)
     * @see com.avetti.simplemerce.domainmodel.IAttributes#getAttributeid()
     */
    public Long getAttributeid() {
        return this.attributeid;
    }

    /* (non-Javadoc)
     * @see com.avetti.simplemerce.domainmodel.IAttributes#setAttributeid(java.lang.Long)
     */
    public void setAttributeid(Long attributeid) {
        this.attributeid = attributeid;
    }

    /* (non-Javadoc)
     * @see com.avetti.simplemerce.domainmodel.IAttributes#getItemid()
     */
    public long getItemid() {
        return this.itemid;
    }

    /* (non-Javadoc)
     * @see com.avetti.simplemerce.domainmodel.IAttributes#setItemid(long)
     */
    public void setItemid(long itemid) {
        this.itemid = itemid;
    }

    /* (non-Javadoc)
     * @see com.avetti.simplemerce.domainmodel.IAttributes#getAttype()
     */
    public String getAttype() {
        return this.attype;
    }

    /* (non-Javadoc)
     * @see com.avetti.simplemerce.domainmodel.IAttributes#setAttype(java.lang.String)
     */
    public void setAttype(String attype) {
        this.attype = attype;
    }

    /* (non-Javadoc)
     * @see com.avetti.simplemerce.domainmodel.IAttributes#getCols()
     */
    public String getCols() {
        return this.cols;
    }

    /* (non-Javadoc)
     * @see com.avetti.simplemerce.domainmodel.IAttributes#setCols(java.lang.String)
     */
    public void setCols(String cols) {
        this.cols = cols;
    }

    /* (non-Javadoc)
     * @see com.avetti.simplemerce.domainmodel.IAttributes#getDefvalue()
     */
    public String getDefvalue() {
        return this.defvalue;
    }

    /* (non-Javadoc)
     * @see com.avetti.simplemerce.domainmodel.IAttributes#setDefvalue(java.lang.String)
     */
    public void setDefvalue(String defvalue) {
        this.defvalue = defvalue;
    }

    /* (non-Javadoc)
     * @see com.avetti.simplemerce.domainmodel.IAttributes#getPrompt()
     */
    public String getPrompt() {
        return this.prompt;
    }

    /* (non-Javadoc)
     * @see com.avetti.simplemerce.domainmodel.IAttributes#setPrompt(java.lang.String)
     */
    public void setPrompt(String prompt) {
        this.prompt = prompt;
    }

    /* (non-Javadoc)
     * @see com.avetti.simplemerce.domainmodel.IAttributes#getDataname()
     */
    public String getDataname() {
        return this.dataname;
    }

    /* (non-Javadoc)
     * @see com.avetti.simplemerce.domainmodel.IAttributes#setDataname(java.lang.String)
     */
    public void setDataname(String dataname) {
        this.dataname = dataname;
    }

    /* (non-Javadoc)
     * @see com.avetti.simplemerce.domainmodel.IAttributes#getDropname()
     */
    public String getDropname() {
        return this.dropname;
    }

    /* (non-Javadoc)
     * @see com.avetti.simplemerce.domainmodel.IAttributes#setDropname(java.lang.String)
     */
    public void setDropname(String dropname) {
        this.dropname = dropname;
    }

    /* (non-Javadoc)
     * @see com.avetti.simplemerce.domainmodel.IAttributes#getRows()
     */
    public String getRows() {
        return this.rows;
    }

    /* (non-Javadoc)
     * @see com.avetti.simplemerce.domainmodel.IAttributes#setRows(java.lang.String)
     */
    public void setRows(String rows) {
        this.rows = rows;
    }

    /* (non-Javadoc)
     * @see com.avetti.simplemerce.domainmodel.IAttributes#getChprice()
     */
    public int getChprice() {
        return this.chprice;
    }

    /* (non-Javadoc)
     * @see com.avetti.simplemerce.domainmodel.IAttributes#setChprice(int)
     */
    public void setChprice(int chprice) {
        this.chprice = chprice;
    }
    
    public void setChpriceObgect(Integer chprice) {
        this.chprice = chprice==null?0:chprice.intValue();
    }    

    /* (non-Javadoc)
     * @see com.avetti.simplemerce.domainmodel.IAttributes#getVendorid()
     */
    public String getVendorid() {
        return this.vendorid;
    }

    /* (non-Javadoc)
     * @see com.avetti.simplemerce.domainmodel.IAttributes#setVendorid(java.lang.String)
     */
    public void setVendorid(String vendorid) {
        this.vendorid = vendorid;
    }

    /* (non-Javadoc)
     * @see com.avetti.simplemerce.domainmodel.IAttributes#getOldattributeid()
     */
    public long getOldattributeid() {
        return this.oldattributeid;
    }

    /* (non-Javadoc)
     * @see com.avetti.simplemerce.domainmodel.IAttributes#setOldattributeid(long)
     */
    public void setOldattributeid(long oldattributeid) {
        this.oldattributeid = oldattributeid;
    }

    /* (non-Javadoc)
     * @see com.avetti.simplemerce.domainmodel.IAttributes#getScreenname1()
     */
    public String getScreenname1() {
        return this.screenname1;
    }

    /* (non-Javadoc)
     * @see com.avetti.simplemerce.domainmodel.IAttributes#setScreenname1(java.lang.String)
     */
    public void setScreenname1(String screenname1) {
        this.screenname1 = screenname1;
    }

    public String getScreenname() {
		return screenname;
	}

	public void setScreenname(String screenname) {
		this.screenname = screenname;
	}

	public String getScreenname3() {
		return screenname3;
	}

	public void setScreenname3(String screenname3) {
		this.screenname3 = screenname3;
	}

	public String toString() {
        return new ToStringBuilder(this)
            .append("attributeid", getAttributeid())
            .toString();
    }

    /* (non-Javadoc)
     * @see com.avetti.simplemerce.domainmodel.IAttributes#equals(java.lang.Object)
     */
    public boolean equals(Object other) {
        if ( !(other instanceof Attributes) ) return false;
        IAttributes castOther = (IAttributes) other;
        return new EqualsBuilder()
            .append(this.getAttributeid(), castOther.getAttributeid())
            .isEquals();
    }

    public int hashCode() {
        return new HashCodeBuilder()
            .append(getAttributeid())
            .toHashCode();
    }

	/* (non-Javadoc)
     * @see com.avetti.simplemerce.domainmodel.IAttributes#getPagetileid()
     */
	public long getPagetileid() {
		return pagetileid;
	}

	/* (non-Javadoc)
     * @see com.avetti.simplemerce.domainmodel.IAttributes#setPagetileid(long)
     */
	public void setPagetileid(long pagetileid) {
		this.pagetileid = pagetileid;
	}

    /* (non-Javadoc)
     * @see com.avetti.simplemerce.domainmodel.IAttributes#getItemlinks()
     */
    public Set<Itemattrib> getItemlinks() {
        return itemlinks;
    }

    /* (non-Javadoc)
     * @see com.avetti.simplemerce.domainmodel.IAttributes#setItemlinks(java.util.Set)
     */
    public void setItemlinks(Set<Itemattrib> itemlinks) {
        this.itemlinks = itemlinks;
    }

    /* (non-Javadoc)
     * @see com.avetti.simplemerce.domainmodel.IAttributes#getOptions()
     */
    public List<Options> getOptions() {
        return options;
    }

    /* (non-Javadoc)
     * @see com.avetti.simplemerce.domainmodel.IAttributes#setOptions(java.util.List)
     */
    public void setOptions(List<Options> options) {
        this.options = options;
    }

}
